#ifndef OBJMESH_H
#define OBJMESH_H

#include <string>
#include <vector>

#include "Vertex.h"

// Material properties per mesh subset
struct Material
{
    std::string strName[MAX_PATH];

    D3DXVECTOR3 Ambient;
    D3DXVECTOR3 Diffuse;
    D3DXVECTOR3 Specular;

    int Shininess;
    float Alpha;

    bool HasSpecular;

    std::string strTexture[MAX_PATH];

    ID3D10ShaderResourceView* pTextureRV10;
    ID3D10EffectTechnique*  pTechnique;
};

class ObjMesh
{
public:
	ObjMesh();
	~ObjMesh();
	void Load(const std::string& fileName);
	//void Render();

private:
	void LoadGeometryFromOBJ(const std::string& fileName);
	void LoadMaterialsFromMTL(const std::string& fileName);

	void BuildMesh();

	ID3DX10Mesh* m_pMesh;         // Encapsulated D3DX Mesh

    std::vector<VertexPNT*> m_Vertices;      // Filled and copied to the vertex buffer
    std::vector<DWORD> m_Indices;       // Filled and copied to the index buffer
    std::vector<DWORD> m_Attributes;    // Filled and copied to the attribute buffer
    std::vector<Material*> m_Materials;     // Holds material properties per subset

};


#endif